﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using nsDalLayer;
using System.Data;
public partial class WebControls_Item : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       // itemDetail();
    }
    clsItem item;
    clsItemPRP itemPrp;
    private void itemDetail()
    {
       item = new clsItem();
        DataSet ds = new DataSet();
        var a = item.LastInserted_Item();

        grditemDetial.DataSource = a;
        grditemDetial.DataBind();
 
    }
    private void itemListBind()
    {//select top 1 * from tbItems order by ItemID desc
        item = new clsItem();
        DataSet ds = new DataSet();

    }
    protected void additem_Click(object sender, EventArgs e)
    {
        try
        {
            item = new clsItem();
            itemPrp = new clsItemPRP();
            itemPrp.Item_GroupID = Convert.ToInt32(Request.QueryString["GroupID"]);
            itemPrp.ItemTitle = txtitemTitle.Text;
            itemPrp.ItemTag=txtitemTag.Text;
            itemPrp.ItemDsc = txtitemDsc.Text;
            string ImagePathFolder = "ImagePath/" + ImageUploder.FileName;
            string ImageThumbFolder = "ThumbPath/" + ImageUploder.FileName;
            string dataFile = "../ThumbPath/" + ImageUploder.FileName;
            string dataFile1 = "../ImagePath/" + ImageUploder.FileName;
            ImageUploder.SaveAs(Server.MapPath(dataFile));
            ImageUploder.SaveAs(Server.MapPath(dataFile1));
            itemPrp.ItemThumbPath = ImageThumbFolder;
            itemPrp.ItemImagePath = ImagePathFolder;
            item.save_rec(itemPrp);
            itemDetail();
        }
        catch(Exception ex)
        {
     
        }

    }
}